package com.mms.imagegenius;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class GalleryImageAdapter extends BaseAdapter {
	/**
	 * Not Used
	 */
	
	private Activity parentActivity;
	private int[] imageID;
	
	public GalleryImageAdapter(Activity parentActivity, int[] imageID){
		this.parentActivity = parentActivity;
		this.imageID = imageID;
	}
	
	@Override
	public int getCount() {
		return this.imageID.length;
	}

	@Override
	public Object getItem(int position) {
		ImageView iView = new ImageView(this.getParentActivity());
		iView.setImageResource(this.imageID[position]);
		return iView;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageView iView = (ImageView) this.getItem(position);
		iView.setScaleType(ImageView.ScaleType.FIT_END);
		iView.setLayoutParams(new Gallery.LayoutParams(95, 70));
		return iView;
	}
	
	private Activity getParentActivity(){
		return this.parentActivity;
	}

}
